//search模块小仓库
import {
  reqGetSearchInfo
} from "@/api";
const state = {
  searchLish: {}
};
const mutations = {
  GETSEARCHLISH(state, searchLish) {
    state.searchLish = searchLish;
  }
};
const actions = {
  //获取search模块数据
  async getSearchLish({
    commit
  }, params = {}) {
    let result = await reqGetSearchInfo(params)
    if (result.code == 200) {
      commit("GETSEARCHLISH", result.data);
    }

  }
};
//项目中getters 主要作用是，简化仓库的数据 
const getters = {
  goodsList(state) {
    return state.searchLish.goodsList || [];
  },
  trademarkList(state) {
    return state.searchLish.trademarkList || [];
  },
  attrsList(state) {
    return state.searchLish.attrsList || [];
  }
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
